﻿using AnesSystem.Services;
using AnesSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.Operation.SC.WJZYY
{
    /// <summary>
    /// 麻醉单头部基本信息
    /// </summary>
    public partial class AnesRecordBaseInfoCtrl : UserControl
    {
        public AnesRecordBaseInfoCtrl()
        {
            InitializeComponent();
            this.Loaded += AnesRecordBaseInfoCtrl_Loaded;
            InteZqJz();
            InitRadioButton();
        }

        private void InitRadioButton()
        {
            new RadioButtonHelper().ChangeRadioSatus(zq, jz);
            new RadioButtonHelper().ChangeRadioSatus(jss, jsf);
            new RadioButtonHelper().ChangeRadioSatus(fjhss, fjhssf);
            new RadioButtonHelper().ChangeRadioSatus(flg, flz, fld);
            new RadioButtonHelper().ChangeRadioSatus(ponvg, ponvz, ponvd);
        }

        private void AnesRecordBaseInfoCtrl_Loaded(object sender, RoutedEventArgs e)
        {
            DateTime ssrqda = DataManager.Instance.CurrentPatientLink.Status.InRoomTime;
            string date = Convert.ToDateTime(ssrqda).ToString("yyyy-MM-dd");
            ssrq.Text = date;
        }



        private void InteZqJz()
        {
            bool zqtrue = DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Asa.Zq;
            bool jztrue = DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Asa.Jz;
            bool jstrue = DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Js;
            bool bjstrue = DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Bis;
            if (!jstrue && !bjstrue)
            {
                if (zqtrue)
                {
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Js = true;
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Jhss = true;
                }
                else if (jztrue)
                {
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Bjs = true;
                    DataManager.Instance.CurrentPatientLink.AnesthesiaRecord.Fjhss = true;

                }
            }

        }



        
    }

}
